package com.plian.system.vo.report;

import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Builder;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

/**
 * 报表视图实体类
 *
 * @author gangan
 * @since 2019-07-24
 */
@Builder
@Data
public class HeaderVO {
	private static final long serialVersionUID = 1L;

	/**
	 * 字段
	 */
	private String key;

	/**
	 * 名称
	 */
	private String title;

	/**
	 * 子表关联主表
	 */
	private String pTable;

	/**
	 * 子表的主表主键
	 */
	private String pId;

	/**
	 * 树节点用
	 */
	private boolean treeNode;

	/**
	 * 名称
	 */
	private String field;

	/**
	 * 子表头
	 */
	private List<HeaderVO> child = new ArrayList<>();

	@JsonInclude(JsonInclude.Include.NON_EMPTY)
	private List<HeaderVO> children = new ArrayList<>();

	public HeaderVO addHeader(HeaderVO header){
		if(this.child==null){
			this.child=new ArrayList<>();
		}
		this.child.add(header);
		return this;
	}
}
